//
//  SecondScrollView.m
//  相册罚写2
//
//  Created by dllo on 15/11/18.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "SecondScrollView.h"

@implementation SecondScrollView

- (instancetype)initWithFrame:(CGRect)frame index:(NSInteger)index
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviewsWithIndex:index];
    }
    return self;
}

- (void)createSubviewsWithIndex:(NSInteger)index
{
    self.backgroundColor = [UIColor whiteColor];
    
//    UIImageView *imageV = [[UIImageView alloc] initWithFrame:self.frame];

        UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    
    self.delegate = self;

    self.minimumZoomScale = 1.0;
    self.maximumZoomScale = 10;
    
    
    NSString *fileName = nil;
    fileName = [NSString stringWithFormat:@"image%ld.jpg", index];
    if (0 == index) {
        imageV.image = [UIImage imageNamed:@"image19.jpg"];
    } else if (20 == index) {
        imageV.image = [UIImage imageNamed:@"image1.jpg"];
    } else {
        imageV.image = [UIImage imageNamed:fileName];
    }

    [self addSubview:imageV];
    [imageV release];
    
    
    
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return scrollView == self ? self.subviews.firstObject : nil;
}


@end
